package xml;

import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

class XMLErrorHandler implements ErrorHandler {
    public void warning(SAXParseException exception) throws SAXException {
        //fortfahren bei Warning
        System.err.println("**Parsing Warning**\r\n" +
                           "  Line:    " + 
                              exception.getLineNumber() + "\r\n" +
                           "  URI:     " + 
                              exception.getSystemId() + "\r\n" +
                           "  Message: " + 
                              exception.getMessage());        
    }
    public void error(SAXParseException exception) throws SAXException {
        //anhalten bei Error
        System.err.println("**Parsing Error**\r\n" +
                           "  Line:    " + 
                              exception.getLineNumber() + "\r\n" +
                           "  URI:     " + 
                              exception.getSystemId() + "\r\n" +
                           "  Message: " + 
                              exception.getMessage());        
        throw new SAXException("Error encountered");
    }
    public void fatalError(SAXParseException exception) throws SAXException {
        //anhalten bei fatal error
        System.err.println("**Parsing Fatal Error**\r\n" +
                           "  Line:    " + 
                              exception.getLineNumber() + "\r\n" +
                           "  URI:     " + 
                              exception.getSystemId() + "\r\n" +
                           "  Message: " + 
                              exception.getMessage());        
        throw new SAXException("Fatal Error encountered");
    }
}